From: Lars Magne Ingebrigtsen Date: Tue, 12 Jul 2011 23:25:50 +0000 (+0200) Subject: Give better error messages when trying to load non-existent symlinks X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~2897 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=6a51e07e584541ac6e80511054251567c9011a71;p=emacs.git Give better error messages when trying to load non-existent symlinks * files.el (after-find-file): Give a better error message when trying to find a symlink that points to a file that doesn't exist (bug#4398). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ead3dc04bc2..9fd1984b107 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2011-07-12 Lars Magne Ingebrigtsen + * files.el (after-find-file): Give a better error message when + trying to find a symlink that points to a file that doesn't exist + (bug#4398). + * progmodes/cc-vars.el: Remove (probably) misleading comment (bug#4396). diff --git a/lisp/files.el b/lisp/files.el index 1071adb6967..bf38ce39a07 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2060,7 +2060,11 @@ unless NOMODES is non-nil." ((not warn) nil) ((and error (file-attributes buffer-file-name)) (setq buffer-read-only t) - "File exists, but cannot be read") + (if (and (file-symlink-p buffer-file-name) + (not (file-exists-p + (file-chase-links buffer-file-name)))) + "Symbolic link that points to nonexistent file" + "File exists, but cannot be read")) ((not buffer-read-only) (if (and warn ;; No need to warn if buffer is auto-saved